local jiang = fk.CreateSkill({
  name = "lingling__jiang",
})

Fk:loadTranslationTable{
  ["lingling__jiang"] = "激昂",
  [":lingling__jiang"] = "出牌阶段限一次，你可以摸X张牌（X为你的手牌、体力、装备区牌数每有一项不多于2的项数）。",

  ["#lingling__jiang"] = "激昂：摸%arg张牌",
}

jiang:addEffect("active", {
  anim_type = "drawcard",
  prompt = function (self, player)
    local n = 0
    if player:getHandcardNum() < 3 then
      n = n + 1
    end
    if player.hp < 3 then
      n = n + 1
    end
    if #player:getCardIds("e") < 3 then
      n = n + 1
    end
    return "#lingling__jiang:::"..n
  end,
  card_num = 0,
  target_num = 0,
  can_use = function(self, player)
    return player:usedSkillTimes(jiang.name, Player.HistoryPhase) == 0 and
      (player:getHandcardNum() < 3 or player.hp < 3 or #player:getCardIds("e") < 3)
  end,
  card_filter = Util.FalseFunc,
  target_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    local n = 0
    if player:getHandcardNum() < 3 then
      n = n + 1
    end
    if player.hp < 3 then
      n = n + 1
    end
    if #player:getCardIds("e") < 3 then
      n = n + 1
    end
    player:drawCards(n, jiang.name)
  end,
})

return jiang
